#define F_CPU 8000000UL
#include <avr/io.h>
#define __DELAY_BACKWARD_COMPATIBLE__ 
#include <util/delay.h>
uint8_t temp;

int main(void)
{
	DDRC=0;	//set ADC0 as analog input
	DDRB=0xF;
	
	ADMUX = _BV(REFS0); //Vref=Vavcc, right justified, ADC0 single-end select
	ADCSRA = _BV(ADEN) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0); //start ADC with 128bit prescale for 125kHz
   
    while(1)
    {
		ADCSRA |= (1<<ADSC);
		while((ADCSRA&(1<<ADIF))==0);
		temp=(uint8_t)ADC;
	    PORTB = 0x6;
	    _delay_ms(temp);
        PORTB = 0xC;
		_delay_ms(temp);
		PORTB = 0x9;
		_delay_ms(temp);
		PORTB = 0x3;
		_delay_ms(temp); 
    }
}